package com.xiyue.leaspring.listener;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.springframework.stereotype.Component;

@Component
public class ConsumerMessageListener implements MessageListener {

	@Override
	public void onMessage(Message message) {//接收消息
		if(message instanceof TextMessage) {
			TextMessage textMsg = (TextMessage)message;
			try {
				System.out.println("【接收到新消息】"+textMsg.getText());
			} catch (JMSException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

}
